using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Design;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using Boom.Navigation;
using Boom.GameObjects;

namespace Boom
{
    /// <summary>
    /// This is the main type for your game
    /// </summary>
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth = Config.PreferredBackBufferWidth;
            graphics.PreferredBackBufferHeight = Config.PreferredBackBufferHeight;
            Content.RootDirectory = "Content";
        }

        private GameWorld NewGame;
        private List<Texture2D> ListTexture;
        private Info TestInfo;
        private MonsterBoss testboss;
    
        protected override void Initialize()
        {
            base.Initialize();
        }

        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            Services.AddService(typeof(SpriteBatch), spriteBatch);
            ListTexture = new List<Texture2D>();
            
            ListTexture.Add(Content.Load<Texture2D>("Boom/Boom"));   
            ListTexture.Add(Content.Load<Texture2D>("Boom/Fire"));   

            ListTexture.Add(Content.Load<Texture2D>("Brick/BrickDes1"));
            ListTexture.Add(Content.Load<Texture2D>("Brick/BrickDes2"));
            ListTexture.Add(Content.Load<Texture2D>("Brick/BrickDes3"));   
            ListTexture.Add(Content.Load<Texture2D>("Brick/BrickNonDes"));

            ListTexture.Add(Content.Load<Texture2D>("Item/ItemCountBoom"));
            ListTexture.Add(Content.Load<Texture2D>("Item/ItemCountLive"));  
            ListTexture.Add(Content.Load<Texture2D>("Item/ItemPowerBoom"));
            ListTexture.Add(Content.Load<Texture2D>("Item/ItemRun"));

            ListTexture.Add(Content.Load<Texture2D>("Monster/MonsterLv1"));
            ListTexture.Add(Content.Load<Texture2D>("Monster/MonsterLv2"));

            ListTexture.Add(Content.Load<Texture2D>("MonsterBoss/MonsterBoss"));
            ListTexture.Add(Content.Load<Texture2D>("MonsterBoss/MonsterFire"));
            ListTexture.Add(Content.Load<Texture2D>("MonsterBoss/MonsterSkill"));

            ListTexture.Add(Content.Load<Texture2D>("Single/Background"));
            ListTexture.Add(Content.Load<Texture2D>("Single/Player"));

            TestInfo = new Info(this, Content.Load<SpriteFont>("Font/FontInfo"), Color.White);

            NewGame = new GameWorld(this, ref ListTexture, "brick.txt", TestInfo);
            Components.Add(NewGame);
            NewGame.Show();
            //NewGame.Pause = true;
            Components.Add(TestInfo);
            //Texture2D TextureBoss = Content.Load<Texture2D>("MonsterBoss/MonsterBoss");
            //testboss = new MonsterBoss(this,ref TextureBoss, new Vector2(400, 400));
            //Components.Add(testboss);

            

        }

        protected override void UnloadContent()
        {
           
        }

        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            
            base.Update(gameTime);
        }

 
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            spriteBatch.Begin();
            
         
        
            base.Draw(gameTime);
            spriteBatch.End();
       
        }
    }
}
